package com.sugon.cloudalibabapayment.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * payment 控制层
 *
 * @author JH
 * @version 1.0
 * @since 2023/2/20 11:22
 */
@RestController
public class PaymentController {

    // @Value(“${}”)是用来获取配置文件
    // @Value("${server.port}") 获取application.yml文件中port
    @Value("${server.port}")
    private String serverPort;

    @GetMapping(value = "/payment/nacos/{id}")
    public String getPayment(@PathVariable("id") Integer id) {
        return "nacos registry, serverPort: " + serverPort + "\t id: " + id;
    }

    @GetMapping(value = "/payment/get/{id}")
    public String gwPayment(@PathVariable("id") Long id) {
        return "gateway test, actual ServerPort: " + serverPort + "\t id: " + id;
    }

    @GetMapping(value = "/payment/lb")
    public String lbPayment() {
        return "nacos registry, serverPort: " + serverPort;
    }

}
